﻿using System.Windows.Forms;
using PowerAwareBluetooth.Controller.Manager;

namespace PowerAwareBluetooth
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            bool? managerIsRunning = (BluetoothPowerManager.ManagerIsRunning(true, true));
            {
                if (managerIsRunning.HasValue)
                {
                    bool notRunning = !managerIsRunning.Value;
                    if (notRunning)
                    {
                        Cursor.Current = Cursors.Default;

                        BluetoothPowerManager bluetoothPowerManager = new BluetoothPowerManager();
                        bluetoothPowerManager.Start(); 

                    }
                    else
                    {
                        const string error = "The manager is already running, only a single blue-tooth manager is allowed.";
                        MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                                        MessageBoxDefaultButton.Button1);
                    }
                }
            }

        }

//        private static void RunBluetoothManagerThread()
//        {
//            BluetoothPowerManager bluetoothPowerManager = new BluetoothPowerManager();
//            bluetoothPowerManager.Start();      
//
//        }
    }
}